package demo4;

public class Test {
    public static void func1(Animal animal){
        animal.eat();
    }
    public static void walk(IRunning iRunning){
      iRunning.run();
    }
    public static void fly(IFly iFly){
        iFly.Fly();
    }
    public static void swim(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void main(String[] args) {
        walk(new Robot());
    }
    public static void main2(String[] args) {
        walk(new Duck("唐老鸭",2));
        walk(new Dog("旺财",1));
        swim(new Duck("唐老鸭",2));
        swim(new Fish("小金鱼",2));
        swim(new Dog("旺财",1));
    }
    public static void main1(String[] args) {
        func1(new Duck("唐老鸭",2));
        func1(new Dog("旺财",1));
        func1(new Fish("小金鱼",2));
    }
}
